/*
 * utils.cc
 *
 *  Created on: Dec 2, 2010
 *      Author: fify
 */

#include <stdio.h>
#include <vector>
#include <string>

using std::vector;
using std::string;

namespace CncrJConfig
{

// Find the sequence: "\r\n", and return the pointer following it.
char * find_end_line(char *s)
{
	char *base = s;

	while(*s)
	{
		if(*s == 0x0a)
		{
			if(s > base && *(s - 1) == 0x0d)
				return s + 1;
		}
		s++;
	}

	return NULL;
}

int expect(const vector<string> result, string str)
{
	for(int i = 0;i<(int)result.size();i++)
	{
		if(result[i].find(str) != string::npos)
			return 1;
	}

	return 0;
}

} // end of namespace.
